package com.alibaba.fastjson.serializer;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.PropertyNamingStrategy;
import com.alibaba.fastjson.util.FieldInfo;
import com.alibaba.fastjson.util.TypeUtils;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/* loaded from: classes.dex */
public class JavaBeanSerializer extends SerializeFilterable implements ObjectSerializer {
    protected SerializeBeanInfo beanInfo;
    protected final FieldSerializer[] getters;
    private volatile transient long[] hashArray;
    private volatile transient short[] hashArrayMapping;
    protected final FieldSerializer[] sortedGetters;

    public JavaBeanSerializer(Class<?> cls) {
        this(cls, (Map<String, String>) null);
    }

    public JavaBeanSerializer(Class<?> cls, String... strArr) {
        this(cls, createAliasMap(strArr));
    }

    static Map<String, String> createAliasMap(String... strArr) {
        HashMap hashMap = new HashMap();
        for (String str : strArr) {
            hashMap.put(str, str);
        }
        return hashMap;
    }

    public Class<?> getType() {
        return this.beanInfo.beanType;
    }

    public JavaBeanSerializer(Class<?> cls, Map<String, String> map) {
        this(TypeUtils.buildBeanInfo(cls, map, null));
    }

    public JavaBeanSerializer(SerializeBeanInfo serializeBeanInfo) {
        boolean z;
        this.beanInfo = serializeBeanInfo;
        this.sortedGetters = new FieldSerializer[serializeBeanInfo.sortedFields.length];
        int i = 0;
        while (true) {
            FieldSerializer[] fieldSerializerArr = this.sortedGetters;
            if (i >= fieldSerializerArr.length) {
                break;
            }
            fieldSerializerArr[i] = new FieldSerializer(serializeBeanInfo.beanType, serializeBeanInfo.sortedFields[i]);
            i++;
        }
        if (serializeBeanInfo.fields == serializeBeanInfo.sortedFields) {
            this.getters = this.sortedGetters;
        } else {
            this.getters = new FieldSerializer[serializeBeanInfo.fields.length];
            int i2 = 0;
            while (true) {
                if (i2 >= this.getters.length) {
                    z = false;
                    break;
                }
                FieldSerializer fieldSerializer = getFieldSerializer(serializeBeanInfo.fields[i2].name);
                if (fieldSerializer == null) {
                    z = true;
                    break;
                } else {
                    this.getters[i2] = fieldSerializer;
                    i2++;
                }
            }
            if (z) {
                FieldSerializer[] fieldSerializerArr2 = this.sortedGetters;
                System.arraycopy(fieldSerializerArr2, 0, this.getters, 0, fieldSerializerArr2.length);
            }
        }
        if (serializeBeanInfo.jsonType != null) {
            for (Class<? extends SerializeFilter> cls : serializeBeanInfo.jsonType.serialzeFilters()) {
                try {
                    addFilter(cls.getConstructor(new Class[0]).newInstance(new Object[0]));
                } catch (Exception unused) {
                }
            }
        }
        if (serializeBeanInfo.jsonType != null) {
            for (Class<? extends SerializeFilter> cls2 : serializeBeanInfo.jsonType.serialzeFilters()) {
                try {
                    addFilter(cls2.getConstructor(new Class[0]).newInstance(new Object[0]));
                } catch (Exception unused2) {
                }
            }
        }
    }

    public void writeDirectNonContext(JSONSerializer jSONSerializer, Object obj, Object obj2, Type type, int i) throws IOException {
        write(jSONSerializer, obj, obj2, type, i);
    }

    public void writeAsArray(JSONSerializer jSONSerializer, Object obj, Object obj2, Type type, int i) throws IOException {
        write(jSONSerializer, obj, obj2, type, i);
    }

    public void writeAsArrayNonContext(JSONSerializer jSONSerializer, Object obj, Object obj2, Type type, int i) throws IOException {
        write(jSONSerializer, obj, obj2, type, i);
    }

    @Override // com.alibaba.fastjson.serializer.ObjectSerializer
    public void write(JSONSerializer jSONSerializer, Object obj, Object obj2, Type type, int i) throws IOException {
        write(jSONSerializer, obj, obj2, type, i, false);
    }

    public void writeNoneASM(JSONSerializer jSONSerializer, Object obj, Object obj2, Type type, int i) throws IOException {
        write(jSONSerializer, obj, obj2, type, i, false);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    /* JADX WARN: Code restructure failed: missing block: B:323:0x043a, code lost:
        if (r0 == false) goto L244;
     */
    /* JADX WARN: Code restructure failed: missing block: B:344:0x0476, code lost:
        r30 = r6;
        r31 = r7;
        r22 = r15;
     */
    /* JADX WARN: Code restructure failed: missing block: B:345:0x047d, code lost:
        if (r21 == false) goto L383;
     */
    /* JADX WARN: Code restructure failed: missing block: B:347:0x0480, code lost:
        r3 = 0;
     */
    /* JADX WARN: Code restructure failed: missing block: B:348:0x0481, code lost:
        writeAfter(r33, r34, r3);
     */
    /* JADX WARN: Code restructure failed: missing block: B:349:0x0487, code lost:
        if (r22.length <= 0) goto L390;
     */
    /* JADX WARN: Code restructure failed: missing block: B:351:0x048f, code lost:
        if (r14.isEnabled(com.alibaba.fastjson.serializer.SerializerFeature.PrettyFormat) == false) goto L390;
     */
    /* JADX WARN: Code restructure failed: missing block: B:352:0x0491, code lost:
        r33.decrementIdent();
        r33.println();
     */
    /* JADX WARN: Code restructure failed: missing block: B:353:0x0497, code lost:
        if (r38 != false) goto L393;
     */
    /* JADX WARN: Code restructure failed: missing block: B:354:0x0499, code lost:
        r14.append(r30);
     */
    /* JADX WARN: Code restructure failed: missing block: B:355:0x049e, code lost:
        r33.context = r31;
     */
    /* JADX WARN: Code restructure failed: missing block: B:356:0x04a2, code lost:
        return;
     */
    /* JADX WARN: Code restructure failed: missing block: B:359:0x04a8, code lost:
        r0 = e;
     */
    /* JADX WARN: Code restructure failed: missing block: B:80:0x011f, code lost:
        r0 = true;
     */
    /* JADX WARN: Removed duplicated region for block: B:100:0x0158  */
    /* JADX WARN: Removed duplicated region for block: B:102:0x0164  */
    /* JADX WARN: Removed duplicated region for block: B:281:0x03af A[Catch: Exception -> 0x0448, all -> 0x04a3, TryCatch #1 {all -> 0x04a3, blocks: (B:110:0x019a, B:113:0x01a2, B:115:0x01ae, B:117:0x01bd, B:119:0x01c7, B:122:0x01d1, B:124:0x01dc, B:126:0x01e0, B:129:0x01e7, B:131:0x01ea, B:133:0x01ef, B:136:0x01f9, B:138:0x0204, B:140:0x0208, B:143:0x020f, B:145:0x0212, B:148:0x021a, B:150:0x0222, B:152:0x022d, B:154:0x0231, B:157:0x0238, B:159:0x023b, B:161:0x0240, B:162:0x0245, B:164:0x024d, B:166:0x0258, B:168:0x025c, B:171:0x0263, B:173:0x0266, B:175:0x026b, B:177:0x0272, B:179:0x0276, B:183:0x0284, B:185:0x0288, B:187:0x0291, B:189:0x029c, B:191:0x02a2, B:193:0x02a6, B:196:0x02b1, B:198:0x02b5, B:200:0x02b9, B:203:0x02c4, B:205:0x02c8, B:207:0x02cc, B:210:0x02d7, B:212:0x02db, B:214:0x02df, B:217:0x02ed, B:219:0x02f1, B:221:0x02f5, B:224:0x0302, B:226:0x0306, B:228:0x030a, B:231:0x0318, B:233:0x031c, B:235:0x0320, B:239:0x032c, B:241:0x0330, B:243:0x0334, B:246:0x033f, B:248:0x034c, B:253:0x0358, B:255:0x035e, B:307:0x0409, B:309:0x040d, B:311:0x0411, B:314:0x041b, B:316:0x0423, B:317:0x042b, B:319:0x0431, B:260:0x0369, B:261:0x036c, B:263:0x0372, B:265:0x037e, B:272:0x0393, B:277:0x039d, B:281:0x03af, B:284:0x03b9, B:287:0x03c3, B:289:0x03cc, B:292:0x03d6, B:293:0x03da, B:294:0x03de, B:296:0x03e3, B:297:0x03e7, B:298:0x03eb, B:300:0x03ef, B:302:0x03f3, B:305:0x0402, B:306:0x0406, B:278:0x03a7, B:334:0x0456, B:348:0x0481, B:350:0x0489, B:352:0x0491, B:354:0x0499), top: B:397:0x019a }] */
    /* JADX WARN: Removed duplicated region for block: B:306:0x0406 A[Catch: Exception -> 0x0448, all -> 0x04a3, TryCatch #1 {all -> 0x04a3, blocks: (B:110:0x019a, B:113:0x01a2, B:115:0x01ae, B:117:0x01bd, B:119:0x01c7, B:122:0x01d1, B:124:0x01dc, B:126:0x01e0, B:129:0x01e7, B:131:0x01ea, B:133:0x01ef, B:136:0x01f9, B:138:0x0204, B:140:0x0208, B:143:0x020f, B:145:0x0212, B:148:0x021a, B:150:0x0222, B:152:0x022d, B:154:0x0231, B:157:0x0238, B:159:0x023b, B:161:0x0240, B:162:0x0245, B:164:0x024d, B:166:0x0258, B:168:0x025c, B:171:0x0263, B:173:0x0266, B:175:0x026b, B:177:0x0272, B:179:0x0276, B:183:0x0284, B:185:0x0288, B:187:0x0291, B:189:0x029c, B:191:0x02a2, B:193:0x02a6, B:196:0x02b1, B:198:0x02b5, B:200:0x02b9, B:203:0x02c4, B:205:0x02c8, B:207:0x02cc, B:210:0x02d7, B:212:0x02db, B:214:0x02df, B:217:0x02ed, B:219:0x02f1, B:221:0x02f5, B:224:0x0302, B:226:0x0306, B:228:0x030a, B:231:0x0318, B:233:0x031c, B:235:0x0320, B:239:0x032c, B:241:0x0330, B:243:0x0334, B:246:0x033f, B:248:0x034c, B:253:0x0358, B:255:0x035e, B:307:0x0409, B:309:0x040d, B:311:0x0411, B:314:0x041b, B:316:0x0423, B:317:0x042b, B:319:0x0431, B:260:0x0369, B:261:0x036c, B:263:0x0372, B:265:0x037e, B:272:0x0393, B:277:0x039d, B:281:0x03af, B:284:0x03b9, B:287:0x03c3, B:289:0x03cc, B:292:0x03d6, B:293:0x03da, B:294:0x03de, B:296:0x03e3, B:297:0x03e7, B:298:0x03eb, B:300:0x03ef, B:302:0x03f3, B:305:0x0402, B:306:0x0406, B:278:0x03a7, B:334:0x0456, B:348:0x0481, B:350:0x0489, B:352:0x0491, B:354:0x0499), top: B:397:0x019a }] */
    /* JADX WARN: Removed duplicated region for block: B:309:0x040d A[Catch: Exception -> 0x0448, all -> 0x04a3, TryCatch #1 {all -> 0x04a3, blocks: (B:110:0x019a, B:113:0x01a2, B:115:0x01ae, B:117:0x01bd, B:119:0x01c7, B:122:0x01d1, B:124:0x01dc, B:126:0x01e0, B:129:0x01e7, B:131:0x01ea, B:133:0x01ef, B:136:0x01f9, B:138:0x0204, B:140:0x0208, B:143:0x020f, B:145:0x0212, B:148:0x021a, B:150:0x0222, B:152:0x022d, B:154:0x0231, B:157:0x0238, B:159:0x023b, B:161:0x0240, B:162:0x0245, B:164:0x024d, B:166:0x0258, B:168:0x025c, B:171:0x0263, B:173:0x0266, B:175:0x026b, B:177:0x0272, B:179:0x0276, B:183:0x0284, B:185:0x0288, B:187:0x0291, B:189:0x029c, B:191:0x02a2, B:193:0x02a6, B:196:0x02b1, B:198:0x02b5, B:200:0x02b9, B:203:0x02c4, B:205:0x02c8, B:207:0x02cc, B:210:0x02d7, B:212:0x02db, B:214:0x02df, B:217:0x02ed, B:219:0x02f1, B:221:0x02f5, B:224:0x0302, B:226:0x0306, B:228:0x030a, B:231:0x0318, B:233:0x031c, B:235:0x0320, B:239:0x032c, B:241:0x0330, B:243:0x0334, B:246:0x033f, B:248:0x034c, B:253:0x0358, B:255:0x035e, B:307:0x0409, B:309:0x040d, B:311:0x0411, B:314:0x041b, B:316:0x0423, B:317:0x042b, B:319:0x0431, B:260:0x0369, B:261:0x036c, B:263:0x0372, B:265:0x037e, B:272:0x0393, B:277:0x039d, B:281:0x03af, B:284:0x03b9, B:287:0x03c3, B:289:0x03cc, B:292:0x03d6, B:293:0x03da, B:294:0x03de, B:296:0x03e3, B:297:0x03e7, B:298:0x03eb, B:300:0x03ef, B:302:0x03f3, B:305:0x0402, B:306:0x0406, B:278:0x03a7, B:334:0x0456, B:348:0x0481, B:350:0x0489, B:352:0x0491, B:354:0x0499), top: B:397:0x019a }] */
    /* JADX WARN: Removed duplicated region for block: B:314:0x041b A[Catch: Exception -> 0x0448, all -> 0x04a3, TryCatch #1 {all -> 0x04a3, blocks: (B:110:0x019a, B:113:0x01a2, B:115:0x01ae, B:117:0x01bd, B:119:0x01c7, B:122:0x01d1, B:124:0x01dc, B:126:0x01e0, B:129:0x01e7, B:131:0x01ea, B:133:0x01ef, B:136:0x01f9, B:138:0x0204, B:140:0x0208, B:143:0x020f, B:145:0x0212, B:148:0x021a, B:150:0x0222, B:152:0x022d, B:154:0x0231, B:157:0x0238, B:159:0x023b, B:161:0x0240, B:162:0x0245, B:164:0x024d, B:166:0x0258, B:168:0x025c, B:171:0x0263, B:173:0x0266, B:175:0x026b, B:177:0x0272, B:179:0x0276, B:183:0x0284, B:185:0x0288, B:187:0x0291, B:189:0x029c, B:191:0x02a2, B:193:0x02a6, B:196:0x02b1, B:198:0x02b5, B:200:0x02b9, B:203:0x02c4, B:205:0x02c8, B:207:0x02cc, B:210:0x02d7, B:212:0x02db, B:214:0x02df, B:217:0x02ed, B:219:0x02f1, B:221:0x02f5, B:224:0x0302, B:226:0x0306, B:228:0x030a, B:231:0x0318, B:233:0x031c, B:235:0x0320, B:239:0x032c, B:241:0x0330, B:243:0x0334, B:246:0x033f, B:248:0x034c, B:253:0x0358, B:255:0x035e, B:307:0x0409, B:309:0x040d, B:311:0x0411, B:314:0x041b, B:316:0x0423, B:317:0x042b, B:319:0x0431, B:260:0x0369, B:261:0x036c, B:263:0x0372, B:265:0x037e, B:272:0x0393, B:277:0x039d, B:281:0x03af, B:284:0x03b9, B:287:0x03c3, B:289:0x03cc, B:292:0x03d6, B:293:0x03da, B:294:0x03de, B:296:0x03e3, B:297:0x03e7, B:298:0x03eb, B:300:0x03ef, B:302:0x03f3, B:305:0x0402, B:306:0x0406, B:278:0x03a7, B:334:0x0456, B:348:0x0481, B:350:0x0489, B:352:0x0491, B:354:0x0499), top: B:397:0x019a }] */
    /* JADX WARN: Removed duplicated region for block: B:327:0x0440  */
    /* JADX WARN: Removed duplicated region for block: B:372:0x04de A[Catch: all -> 0x055f, TRY_ENTER, TryCatch #12 {all -> 0x055f, blocks: (B:369:0x04bc, B:372:0x04de, B:380:0x052e, B:382:0x0534, B:383:0x054c, B:385:0x0550, B:389:0x0559, B:390:0x055e, B:374:0x04f3, B:376:0x04f7, B:378:0x04fd, B:379:0x0518), top: B:413:0x04bc }] */
    /* JADX WARN: Removed duplicated region for block: B:373:0x04f1  */
    /* JADX WARN: Removed duplicated region for block: B:382:0x0534 A[Catch: all -> 0x055f, TryCatch #12 {all -> 0x055f, blocks: (B:369:0x04bc, B:372:0x04de, B:380:0x052e, B:382:0x0534, B:383:0x054c, B:385:0x0550, B:389:0x0559, B:390:0x055e, B:374:0x04f3, B:376:0x04f7, B:378:0x04fd, B:379:0x0518), top: B:413:0x04bc }] */
    /* JADX WARN: Removed duplicated region for block: B:385:0x0550 A[Catch: all -> 0x055f, TryCatch #12 {all -> 0x055f, blocks: (B:369:0x04bc, B:372:0x04de, B:380:0x052e, B:382:0x0534, B:383:0x054c, B:385:0x0550, B:389:0x0559, B:390:0x055e, B:374:0x04f3, B:376:0x04f7, B:378:0x04fd, B:379:0x0518), top: B:413:0x04bc }] */
    /* JADX WARN: Removed duplicated region for block: B:387:0x0556  */
    /* JADX WARN: Removed duplicated region for block: B:388:0x0557  */
    /* JADX WARN: Removed duplicated region for block: B:413:0x04bc A[EXC_TOP_SPLITTER, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:415:0x0476 A[EDGE_INSN: B:415:0x0476->B:344:0x0476 ?: BREAK  , SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:48:0x00a7  */
    /* JADX WARN: Removed duplicated region for block: B:49:0x00aa  */
    /* JADX WARN: Removed duplicated region for block: B:52:0x00b7  */
    /* JADX WARN: Removed duplicated region for block: B:53:0x00b9  */
    /* JADX WARN: Removed duplicated region for block: B:58:0x00ce A[Catch: Exception -> 0x04ac, all -> 0x04af, TRY_LEAVE, TryCatch #3 {Exception -> 0x04ac, blocks: (B:56:0x00cb, B:58:0x00ce), top: B:400:0x00cb }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public void write(com.alibaba.fastjson.serializer.JSONSerializer r33, java.lang.Object r34, java.lang.Object r35, java.lang.reflect.Type r36, int r37, boolean r38) throws java.io.IOException {
        /*
            Method dump skipped, instructions count: 1381
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: com.alibaba.fastjson.serializer.JavaBeanSerializer.write(com.alibaba.fastjson.serializer.JSONSerializer, java.lang.Object, java.lang.Object, java.lang.reflect.Type, int, boolean):void");
    }

    protected void writeClassName(JSONSerializer jSONSerializer, String str, Object obj) {
        if (str == null) {
            str = jSONSerializer.config.typeKey;
        }
        jSONSerializer.out.writeFieldName(str, false);
        String str2 = this.beanInfo.typeName;
        if (str2 == null) {
            Class<?> cls = obj.getClass();
            if (TypeUtils.isProxy(cls)) {
                cls = cls.getSuperclass();
            }
            str2 = cls.getName();
        }
        jSONSerializer.write(str2);
    }

    public boolean writeReference(JSONSerializer jSONSerializer, Object obj, int i) {
        SerialContext serialContext = jSONSerializer.context;
        int i2 = SerializerFeature.DisableCircularReferenceDetect.mask;
        if (serialContext != null && (serialContext.features & i2) == 0 && (i & i2) == 0 && jSONSerializer.references != null && jSONSerializer.references.containsKey(obj)) {
            jSONSerializer.writeReference(obj);
            return true;
        }
        return false;
    }

    protected boolean isWriteAsArray(JSONSerializer jSONSerializer) {
        return isWriteAsArray(jSONSerializer, 0);
    }

    protected boolean isWriteAsArray(JSONSerializer jSONSerializer, int i) {
        int i2 = SerializerFeature.BeanToArray.mask;
        return ((this.beanInfo.features & i2) == 0 && !jSONSerializer.out.beanToArray && (i & i2) == 0) ? false : true;
    }

    public Object getFieldValue(Object obj, String str) {
        FieldSerializer fieldSerializer = getFieldSerializer(str);
        if (fieldSerializer == null) {
            throw new JSONException("field not found. " + str);
        }
        try {
            return fieldSerializer.getPropertyValue(obj);
        } catch (IllegalAccessException e) {
            throw new JSONException("getFieldValue error." + str, e);
        } catch (InvocationTargetException e2) {
            throw new JSONException("getFieldValue error." + str, e2);
        }
    }

    public Object getFieldValue(Object obj, String str, long j, boolean z) {
        FieldSerializer fieldSerializer = getFieldSerializer(j);
        if (fieldSerializer == null) {
            if (z) {
                throw new JSONException("field not found. " + str);
            }
            return null;
        }
        try {
            return fieldSerializer.getPropertyValue(obj);
        } catch (IllegalAccessException e) {
            throw new JSONException("getFieldValue error." + str, e);
        } catch (InvocationTargetException e2) {
            throw new JSONException("getFieldValue error." + str, e2);
        }
    }

    public FieldSerializer getFieldSerializer(String str) {
        if (str == null) {
            return null;
        }
        int i = 0;
        int length = this.sortedGetters.length - 1;
        while (i <= length) {
            int i2 = (i + length) >>> 1;
            int compareTo = this.sortedGetters[i2].fieldInfo.name.compareTo(str);
            if (compareTo < 0) {
                i = i2 + 1;
            } else if (compareTo <= 0) {
                return this.sortedGetters[i2];
            } else {
                length = i2 - 1;
            }
        }
        return null;
    }

    public FieldSerializer getFieldSerializer(long j) {
        PropertyNamingStrategy[] propertyNamingStrategyArr;
        int binarySearch;
        if (this.hashArray == null) {
            propertyNamingStrategyArr = PropertyNamingStrategy.values();
            long[] jArr = new long[this.sortedGetters.length * propertyNamingStrategyArr.length];
            int i = 0;
            int i2 = 0;
            while (true) {
                FieldSerializer[] fieldSerializerArr = this.sortedGetters;
                if (i >= fieldSerializerArr.length) {
                    break;
                }
                String str = fieldSerializerArr[i].fieldInfo.name;
                int i3 = i2 + 1;
                jArr[i2] = TypeUtils.fnv1a_64(str);
                for (PropertyNamingStrategy propertyNamingStrategy : propertyNamingStrategyArr) {
                    String translate = propertyNamingStrategy.translate(str);
                    if (!str.equals(translate)) {
                        jArr[i3] = TypeUtils.fnv1a_64(translate);
                        i3++;
                    }
                }
                i++;
                i2 = i3;
            }
            Arrays.sort(jArr, 0, i2);
            this.hashArray = new long[i2];
            System.arraycopy(jArr, 0, this.hashArray, 0, i2);
        } else {
            propertyNamingStrategyArr = null;
        }
        int binarySearch2 = Arrays.binarySearch(this.hashArray, j);
        if (binarySearch2 < 0) {
            return null;
        }
        if (this.hashArrayMapping == null) {
            if (propertyNamingStrategyArr == null) {
                propertyNamingStrategyArr = PropertyNamingStrategy.values();
            }
            short[] sArr = new short[this.hashArray.length];
            Arrays.fill(sArr, (short) -1);
            int i4 = 0;
            while (true) {
                FieldSerializer[] fieldSerializerArr2 = this.sortedGetters;
                if (i4 >= fieldSerializerArr2.length) {
                    break;
                }
                String str2 = fieldSerializerArr2[i4].fieldInfo.name;
                int binarySearch3 = Arrays.binarySearch(this.hashArray, TypeUtils.fnv1a_64(str2));
                if (binarySearch3 >= 0) {
                    sArr[binarySearch3] = (short) i4;
                }
                for (PropertyNamingStrategy propertyNamingStrategy2 : propertyNamingStrategyArr) {
                    String translate2 = propertyNamingStrategy2.translate(str2);
                    if (!str2.equals(translate2) && (binarySearch = Arrays.binarySearch(this.hashArray, TypeUtils.fnv1a_64(translate2))) >= 0) {
                        sArr[binarySearch] = (short) i4;
                    }
                }
                i4++;
            }
            this.hashArrayMapping = sArr;
        }
        short s = this.hashArrayMapping[binarySearch2];
        if (s != -1) {
            return this.sortedGetters[s];
        }
        return null;
    }

    public List<Object> getFieldValues(Object obj) throws Exception {
        ArrayList arrayList = new ArrayList(this.sortedGetters.length);
        for (FieldSerializer fieldSerializer : this.sortedGetters) {
            arrayList.add(fieldSerializer.getPropertyValue(obj));
        }
        return arrayList;
    }

    public List<Object> getObjectFieldValues(Object obj) throws Exception {
        FieldSerializer[] fieldSerializerArr;
        ArrayList arrayList = new ArrayList(this.sortedGetters.length);
        for (FieldSerializer fieldSerializer : this.sortedGetters) {
            Class<?> cls = fieldSerializer.fieldInfo.fieldClass;
            if (!cls.isPrimitive() && !cls.getName().startsWith("java.lang.")) {
                arrayList.add(fieldSerializer.getPropertyValue(obj));
            }
        }
        return arrayList;
    }

    public int getSize(Object obj) throws Exception {
        int i = 0;
        for (FieldSerializer fieldSerializer : this.sortedGetters) {
            if (fieldSerializer.getPropertyValueDirect(obj) != null) {
                i++;
            }
        }
        return i;
    }

    public Set<String> getFieldNames(Object obj) throws Exception {
        FieldSerializer[] fieldSerializerArr;
        HashSet hashSet = new HashSet();
        for (FieldSerializer fieldSerializer : this.sortedGetters) {
            if (fieldSerializer.getPropertyValueDirect(obj) != null) {
                hashSet.add(fieldSerializer.fieldInfo.name);
            }
        }
        return hashSet;
    }

    public Map<String, Object> getFieldValuesMap(Object obj) throws Exception {
        FieldSerializer[] fieldSerializerArr;
        LinkedHashMap linkedHashMap = new LinkedHashMap(this.sortedGetters.length);
        for (FieldSerializer fieldSerializer : this.sortedGetters) {
            boolean isEnabled = SerializerFeature.isEnabled(fieldSerializer.features, SerializerFeature.SkipTransientField);
            FieldInfo fieldInfo = fieldSerializer.fieldInfo;
            if (!isEnabled || fieldInfo == null || !fieldInfo.fieldTransient) {
                if (fieldSerializer.fieldInfo.unwrapped) {
                    Object json = JSON.toJSON(fieldSerializer.getPropertyValue(obj));
                    if (json instanceof Map) {
                        linkedHashMap.putAll((Map) json);
                    } else {
                        linkedHashMap.put(fieldSerializer.fieldInfo.name, fieldSerializer.getPropertyValue(obj));
                    }
                } else {
                    linkedHashMap.put(fieldSerializer.fieldInfo.name, fieldSerializer.getPropertyValue(obj));
                }
            }
        }
        return linkedHashMap;
    }

    protected BeanContext getBeanContext(int i) {
        return this.sortedGetters[i].fieldContext;
    }

    protected Type getFieldType(int i) {
        return this.sortedGetters[i].fieldInfo.fieldType;
    }

    protected char writeBefore(JSONSerializer jSONSerializer, Object obj, char c) {
        if (jSONSerializer.beforeFilters != null) {
            for (BeforeFilter beforeFilter : jSONSerializer.beforeFilters) {
                c = beforeFilter.writeBefore(jSONSerializer, obj, c);
            }
        }
        if (this.beforeFilters != null) {
            for (BeforeFilter beforeFilter2 : this.beforeFilters) {
                c = beforeFilter2.writeBefore(jSONSerializer, obj, c);
            }
        }
        return c;
    }

    protected char writeAfter(JSONSerializer jSONSerializer, Object obj, char c) {
        if (jSONSerializer.afterFilters != null) {
            for (AfterFilter afterFilter : jSONSerializer.afterFilters) {
                c = afterFilter.writeAfter(jSONSerializer, obj, c);
            }
        }
        if (this.afterFilters != null) {
            for (AfterFilter afterFilter2 : this.afterFilters) {
                c = afterFilter2.writeAfter(jSONSerializer, obj, c);
            }
        }
        return c;
    }

    protected boolean applyLabel(JSONSerializer jSONSerializer, String str) {
        if (jSONSerializer.labelFilters != null) {
            for (LabelFilter labelFilter : jSONSerializer.labelFilters) {
                if (!labelFilter.apply(str)) {
                    return false;
                }
            }
        }
        if (this.labelFilters != null) {
            for (LabelFilter labelFilter2 : this.labelFilters) {
                if (!labelFilter2.apply(str)) {
                    return false;
                }
            }
            return true;
        }
        return true;
    }
}
